<template>
  <el-container>
    <el-header>
      <h1>所有用户信息</h1>
    </el-header>
    <el-main>
      <el-table 
        :data="allData">
        <el-table-column v-for="(col,i) in columns" :key="i" :label="col.label" :prop="col.prop"></el-table-column>
      </el-table>
    </el-main>
    <el-footer></el-footer>
  </el-container>
</template>

<script>
export default {
  name: 'ListPage',
  data() {
    return {
      columns: [
        {prop: 'name', label: '名字'},
        {prop: 'username', label: '账户'}
      ],
      allData: [
        {username: 'zhangsan', name: '张三'},
        {username: 'lisi', name: '李四'},
        {username: 'wangwu', name: '王五'},
      ]
    };
  },
  mounted() {
    this.getList()
  },
  methods: {
    getList() {
      this.$api.api_user.list({}).then(res => {
        this.allData = res;
        console.log(res);
      })
    }
  }
}

</script>

<style>
</style>